<?php

    class object_info extends MX_Controller 
    {

        private $data;

        function __construct()
        {
            parent::__construct();
            if(!$this->session->userdata('logged_in'))
                redirect(base_url('login'));

            $this->load->config('pages');
            $this->load->library('object_lib');
            $this->load->library('translate');

        }

        // View info page
        function view($object_id)
        {
            $this->data['page'] =  'Object';
            $this->data['title'] =  'Information';
            $this->data['object_ID'] =  $object_id;
            $this->data['post_action'] =  'EDIT';
            $this->data['object'] =  $this->object_lib->find_id($object_id);

            $this->template->build('object_info/info',$this->data);
        }

        // Add info to DB
        function submit_info()
        {
            // update information column on object table
            $this->object_lib->edit_info($_POST['object_ID'],$_POST['content'],config_item('wp_languages'));

            // Send message
            echo json_encode(array("action"=>true,"msg"=>"Successful info operation."));
        }

    }
?>